<?php
	
	// On importe la source
	require_once("../../sql/Database.php");

	// On créé une instance
	$db = new Database();
	
	// On recupere les articles
	$getArticles = $db->db_getArticles();
	
	foreach($getArticles as $article){		
?>	
	<table class="table_articles">
		
		<tr>
			<th colspan="2">
				<?php echo $article->aid;  ?>
			</th>
		</tr>
		
		<tr>
			<td colspan="2">
				<?php echo $article->data;  ?>
			</td>
		</tr>
		
		<tr>
			<td>
				<?php echo $db->db_getUserbyId($article->author)->name;  ?> à
				<?php echo date('h:i:s \l\e d/m/Y', $article->created);  ?>
			</td>
		</tr>
		
		<tr>
			<td>
				<?php 
					$nbCommentaires = count($db->db_getCommentsByNode($article->nid));
					if($nbCommentaires > 0){
						print("{$nbCommentaires} commentaires");
					}else{
						print("{$nbCommentaires} commentaire");
					}
				?>
			</td>
			<td>
				+ - o
			</td>
		</tr>
		
		
	
	</table>
<?php		
	}
?>